package 笔试;

import java.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        //int count = 0;
        List<Integer> leftlist = new ArrayList<>();
        List<Integer> rightlist = new ArrayList<>();
        Stack<int[]> stack = new Stack<>();
        for(int i=0;i<str.length();i++){
            if(str.charAt(i)=='('){
                //count++;
                //leftlist.add(i);
                stack.push(new int[]{str.charAt(i),i});
            }
            if(str.charAt(i)==')' && stack.peek()[0]=='('){
                rightlist.add(i);
                leftlist.add(stack.pop()[1]);
            }else if(str.charAt(i)==')'){
                stack.push(new int[]{str.charAt(i),i});
            }
        }
        System.out.println(leftlist.size());
        TreeMap<Integer,Integer> map = new TreeMap<>(); //对索引值进行排序
        for(int i=0;i<leftlist.size();i++){
            map.put(leftlist.get(i),rightlist.get(i));
        }
        for (int i:map.keySet()) {
            System.out.println(i);
            System.out.println(map.get(i));
        }

    }

}
